
<?php $this->load->view('header');?>

<body class="login" mycollectionplug="bind">
	<div class="login_m">
		<form class="layui-form" action="" method="post">
			<div class="login_boder">
				<div class="login_padding" id="login_model">

					<label class="layui-form-label" style="text-align: left;padding: 0 0 10px 0px;">用户名</label>
					<input type="text" name="username" required  lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input" style="margin: 10px 0px;">

					<label class="layui-form-label" style="text-align: left;padding: 0 0 10px 0px;">登录密码</label>
				   <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input"  style="margin: 10px 0px;">
				  
				  <input type="hidden" value="is_login" name="islogin" />
				  <div class="layui-form-item">
				    <div class="layui-input-block" style="margin-left: 80px;padding-top: 20px;">
				      <button class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo" style="width: 137px;">登 录</button>
				    </div>
				  </div>
				</div>
			</div>
		</form>
	</div>
	
	<script>
		layui.use(['form','jquery'], function()
		{
			var $= layui.jquery,
		  		 form = layui.form;
		  //监听提交
		  form.on('submit(formDemo)', function(data)
		  {
  
		    $.post('admin.php/login/login', data.field, function(res) {
		    	/*optional stuff to do after success */
		    	if (res.status == 200) {
		    		layer.msg(res.message);
		    		location.reload();
		    	}
		    	else
		    	{
		    		layer.msg(res.message);
		    	}
		    	
		    },"json");

		    return false;
		  });

		  	//session过期，刷新父级页面
			if(window !=top){  
			    top.location.href=location.href;  
			} 

		});
	</script>

</body>
</html>